package com.aaa.sbm.controller;

import com.aaa.sbm.entity.Customer;
import com.aaa.sbm.service.CustomerService;
import com.aaa.sbm.util.Page;
import com.aaa.sbm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/customer")
public class CustomerController {

    @Resource
    private CustomerService customerService;

    @RequestMapping("/list")
    public Result getCustomerList(@RequestBody Page<Customer> page){
        return customerService.getCustomerList(page);
    }

    @RequestMapping("/insert")
    public Result insertCustomer(@RequestBody Customer customer){
        return customerService.insertCustomer(customer);
    }

    @PostMapping("/update")
    public Result updateCustomer(@RequestBody Customer customer){
        return customerService.updateCustomer(customer);
    }

    @DeleteMapping("/delete/{id}")
    public Result deleteCustomer(@PathVariable Integer id){
        return customerService.deleteCustomer(id);
    }

    @RequestMapping("/listStatus")
    public Result listStatus(){
        return customerService.listStatus();
    }
}
